(function(vc){
    vc.extends({
        propTypes: {
           emitChooseShopHouse:vc.propTypes.string,
           emitLoadData:vc.propTypes.string
        },
        data:{
            chooseShopHouseInfo:{
                shopHouses:[],
                _currentShopHouseName:'',
            }
        },
        _initMethod:function(){
        },
        _initEvent:function(){
            vc.on('chooseShopHouse','openChooseShopHouseModel',function(_param){
                $('#chooseShopHouseModel').modal('show');
                $that._refreshChooseShopHouseInfo();
                $that._loadAllShopHouseInfo(1,10,'');
            });
        },
        methods:{
            _loadAllShopHouseInfo:function(_page,_row,_name){
                var param = {
                    params:{
                        page:_page,
                        row:_row,
                        communityId:vc.getCurrentCommunity().communityId,
                        name:_name
                    }
                };

                //发送get请求
               vc.http.apiGet('shopHouse.listShopHouses',
                             param,
                             function(json){
                                var _shopHouseInfo = JSON.parse(json);
                                $that.chooseShopHouseInfo.shopHouses = _shopHouseInfo.shopHouses;
                             },function(){
                                console.log('请求失败处理');
                             }
                           );
            },
            chooseShopHouse:function(_shopHouse){
                if(_shopHouse.hasOwnProperty('name')){
                     _shopHouse.shopHouseName = _shopHouse.name;
                }
                vc.emit($props.emitChooseShopHouse,'chooseShopHouse',_shopHouse);
                vc.emit($props.emitLoadData,'listShopHouseData',{
                    shopHouseId:_shopHouse.shopHouseId
                });
                $('#chooseShopHouseModel').modal('hide');
            },
            queryShopHouses:function(){
                $that._loadAllShopHouseInfo(1,10,$that.chooseShopHouseInfo._currentShopHouseName);
            },
            _refreshChooseShopHouseInfo:function(){
                $that.chooseShopHouseInfo._currentShopHouseName = "";
            }
        }

    });
})(window.vc);
